package com.fenghongzhang.shop1903.test;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * 具体的观察者
 */
public class SubSubject implements Subject {

    List<Observer> userlist = new ArrayList<>();
    @Override
    public void attach(Observer observer) {
        userlist.add(observer);
    }

    @Override
    public void detach(Observer observer) {
        userlist.remove(observer);
    }

    @Override
    public void notify(String string) {
        for (Observer user : userlist) {
            user.notify();
        }
    }
}
